//
// SoapTrace.Net - A soap message monitoring utility. 
//
// Copyright (C) 2005 Matthew Ward
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
// Matthew Ward (mrward@users.sourceforge.net)

using SoapTrace.Core.Communication;
using System;
using System.Xml.Serialization;

namespace SoapTrace.Core
{
	/// <summary>
	/// Configuration for each <see	cref="SoapMessageMonitor"/> Manager.
	/// </summary>
	[ XmlType( "soapMessageMonitor" ) ]
	public class MonitorManagerConfiguration
	{
		/// <summary>
		/// Remote server's IP address.
		/// </summary>
		private string m_RemoteServerIPAddress = "localhost";

		/// <summary>
		/// Remote server's port.
		/// </summary>
		private int m_RemoteServerPort = 80;

		/// <summary>
		/// Listening port for the soap trace proxy.
		/// </summary>
		private int m_ProxyServerListeningPort = 8080;

		/// <summary>
		/// A status flag indicating whether we are using a proxy server.
		/// </summary>
		private bool m_UseProxyServer = true;

		/// <summary>
		/// A status flag indicating whether we are using winpcap packet capture.
		/// </summary>
		private bool m_UseWinPcap;

		/// <summary>
		/// A status flag indicating whether we are using raw sockets packet capture.
		/// </summary>
		private bool m_UseRawSockets;

		/// <summary>
		/// A status flag indicating whether we will capture data from tcp
		/// packets when we missed the initial connection.
		/// </summary>
		private bool m_MissedConnectionCaptureEnabled = true;
		
		/// <summary>
		/// The name of the network interface to use when capturing
		/// packets.
		/// </summary>
		private string m_NetworkInterfaceName = String.Empty;
		
		/// <summary>
		/// Creates a new instance of the 
		/// <see cref="MonitorManagerConfiguration"/>.
		/// </summary>
		public MonitorManagerConfiguration( )
		{
		}
		
		/// <summary>
		/// Gets or sets the remote server's IP address.
		/// </summary>
		[ XmlElement( "remoteServerIPAddress" ) ]
		public string RemoteServerIPAddress
		{
			get
			{
				return m_RemoteServerIPAddress;
			}

			set
			{
				m_RemoteServerIPAddress = value;
			}
		}
		
		/// <summary>
		/// Gets the remote server's port.
		/// </summary>
		[ XmlElement( "remoteServerPort" ) ]
		public int RemoteServerPort
		{
			get
			{
				return m_RemoteServerPort;
			}

			set
			{
				m_RemoteServerPort = value;
			}
		}

		/// <summary>
		/// Gets the proxy server's port.
		/// </summary>
		[ XmlElement( "proxyServerListeningPort" ) ]
		public int ProxyServerListeningPort
		{
			get
			{
				return m_ProxyServerListeningPort;
			}

			set
			{
				m_ProxyServerListeningPort = value;
			}
		}

		/// <summary>
		/// Gets whether the soap trace application should use a proxy server
		/// for message monitoring.
		/// </summary>
		[ XmlElement( "useProxyServer" ) ]
		public bool UseProxyServer
		{
			get
			{
				return m_UseProxyServer;
			}

			set
			{
				m_UseProxyServer = value;
			}
		}

		/// <summary>
		/// Gets whether the soap trace application should use winpcap packet capture
		/// for message monitoring.
		/// </summary>
		[ XmlElement( "useWinPcap" ) ]
		public bool UseWinPcap
		{
			get
			{
				return m_UseWinPcap;
			}

			set
			{
				m_UseWinPcap = value;
			}
		}
		
		/// <summary>
		/// Gets whether the soap trace application should use raw sockets packet 
		/// capture for message monitoring.
		/// </summary>
		[ XmlElement( "useRawSockets" ) ]
		public bool UseRawSockets
		{
			get
			{
				return m_UseRawSockets;
			}

			set
			{
				m_UseRawSockets = value;
			}
		}		

		/// <summary>
		/// Gets or sets the network interface name to use
		/// when capturing packets.
		/// </summary>
		[ XmlElement( "networkInterfaceName" ) ]
		public string NetworkInterfaceName 
		{
			get 
			{
				return m_NetworkInterfaceName;
			}
			set 
			{
				m_NetworkInterfaceName = value;
			}
		}
		
		/// <summary>
		/// Gets or sets whether tcp packets should be captured when we 
		/// missed the initial connection.
		/// </summary>
		[ XmlElement( "missedConnectionCaptureEnabled" ) ]
		public bool MissedConnectionCaptureEnabled
		{
			get
			{
				return m_MissedConnectionCaptureEnabled;
			}
			
			set
			{
				m_MissedConnectionCaptureEnabled = value;
			}
		}		
	}
}
